package com.shenkh.usunshine.spring.helloworld.aop;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Aspect
public class HelloWorldAdvisor {
	private Logger logger = LoggerFactory.getLogger(HelloWorldAdvisor.class);
	
	@Before("com.shenkh.usunshine.spring.helloworld.aop.GreetingAspect.greet() " +
			"&& com.shenkh.usunshine.spring.helloworld.aop.GreetingAspect.isGreeting() " +
			"&& com.shenkh.usunshine.spring.helloworld.aop.HelloWorldAspect.inHelloWorld()")
	public void beforeGreet() {
		logger.info("Before greet.");
	}
	
	@Before(value="com.shenkh.usunshine.spring.helloworld.aop.AnotherGreetingAspect.anotherGreet() " +
			"&& com.shenkh.usunshine.spring.helloworld.aop.AnotherGreetingAspect.isAnotherGreeting() " +
			"&& com.shenkh.usunshine.spring.helloworld.aop.HelloWorldAspect.inHelloWorld() " +
			"&& args(greetingWords)",
			argNames="greetingWords")
	public void beforeAnotherGreet(String greetingWords) {
		logger.info("Before another greet. GreetingWords: " + greetingWords);
	}
}
